package Class_04_12;

abstract class workers   //人员
{
    private String name;
    private String address;

    public workers() {
    }

    public workers(String name, String address) {
        this.name = name;
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    abstract void raise(String flag);//抽象方法，涨工资
}

//员工
class staff extends workers
{
    private String ID;
    private double salary;
    private int seniority;
    private String flag;

    public staff() {
    }

    public staff(String name, String address, String ID, double salary, int seniority,String flag) {
        super(name, address);
        this.ID = ID;
        this.salary = salary;
        this.seniority = seniority;
        this.flag = flag;
    }

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public int getSeniority() {
        return seniority;
    }

    public void setSeniority(int seniority) {
        this.seniority = seniority;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    void raise(String flag)
    {
        if("1".equals(flag))
        {
            setSalary(getSalary() * 1.1);
        }
    }
}

//经理
class manager extends workers
{
    private String ID;
    private double salary;
    private int seniority;
    private String flag;

    public manager() {
    }

    public manager(String name, String address, String ID, double salary, int seniority, String flag) {
        super(name, address);
        this.ID = ID;
        this.salary = salary;
        this.seniority = seniority;
        this.flag = flag;
    }

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public int getSeniority() {
        return seniority;
    }

    public void setSeniority(int seniority) {
        this.seniority = seniority;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    void raise(String flag)
    {
        if("1".equals(flag))
        {
            setSalary(getSalary() * 1.2);
        }
    }
}
public class Main1 {
    public static void main(String[] args) {
        //定义 flag = "1"为涨工资
        staff person1 = new staff("张三","北京","12306",8700,2,"1");
        manager person2 = new manager("李华","江苏","51159",12000,4,"1");

        person1.raise(person1.getFlag());
        person2.raise(person2.getFlag());
        System.out.println("涨工资后" + person1.getName() + "的工资为" + person1.getSalary());
        System.out.println("涨工资后" + person2.getName() + "的工资为" + person2.getSalary());
    }
}
